<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>商品添加</title>
    <script>
        var index = 1;
        function addDetail() {
            var div = document.getElementById("detailDiv");
            var d1 = document.createElement("div");
            var p1 = document.createElement("input");
            p1.type = "file";
            p1.name = "detail"+index;
            var p2 = document.createElement("input");
            p2.type = "number";
            p2.name = "order"+index;

            d1.appendChild(p1);d1.appendChild(p2);

            div.appendChild(d1);
            index++;
        }
    </script>
</head>
<body>
    <h2>商品添加</h2>
    <form action="/wbs20052/shop/product_add_service.php" method="post" enctype="multipart/form-data" >
        商品名称:<input type="text" name="name" ><br>
        简介: <textarea name="info" cols="20" rows="5"></textarea><br>
        单价:<input type="text" name="price" ><br>
        单位:<input type="text" name="unit" ><br>
        封面图片:<input type="file" name="image" ><br>
        <hr>
        <h3>详情图片:</h3>
        <div id="detailDiv" >
            
        </div>
        <div>
            <button type="button" onclick="addDetail()" >添加详情图片</button>
        </div>
        <br>
        <input type="submit" value="添加" >
    </form>
</body>
</html>